package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.activity.switcher.slide.SlideActivity;
import com.qianxx.component.activity.switcher.switch_compat.SwitchCompatActivity;
import com.qianxx.component.activity.switcher.toggle_button.ToggleButtonActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class SwitchActivity extends BaseActivity {
    @BindView(R.id.lv)
    ListView lv;
    String[] listItems = {"SwitchCompat", "ToggleButtom", "Slide"};
    ArrayAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_switch);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item, listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Class cls = null;
        switch (arg2) {
            case 0:
                cls = SwitchCompatActivity.class;
                break;
            case 1:
                cls = ToggleButtonActivity.class;
                break;
            case 2:
                cls = SlideActivity.class;
                break;
            default:

                break;
        }
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

    @Override
    public String setTitle() {
        return "开关类";
    }
}
